-
Notifications
You must be signed in to change notification settings - Fork 53
Adds long-running websocket stream consumer example #51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
65a0905 to
8d5b904
Compare
e77f8ed to
04bd250
Compare
| """Handle WebSocket error event.""" | ||
| print(f"WebSocket error: {event}") | ||
| self.connected = False | ||
| self.ctx.abort("WebSocket error occurred") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does ctx.abort() behave well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should do, why wouldn't it? It restarts the DO.
hoodmane
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally LGTM.
04bd250 to
984758d
Compare
for more information, see https://pre-commit.ci
This is something that we don't even have as an example for JS: a long-running Durable Object which streams data from a web socket.
This one listens to Bluesky's jetstream to grab events for each post on Bluesky. It then prints at most one every second.
Deployed to https://python-websocket-stream-consumer.runtime-playground.workers.dev.